export default {
  // 监听输入框
  monitor: function (rule, e) {
    let _this = this;
    _this.$refs[rule].fields.forEach(item => {
      if (item.prop === e) {
        item.clearValidate();
      }
    });
  },

  // 监听上传图片
   upload:function (rule, e) {
    let _this = this;
    _this.$refs[rule].fields.forEach(item => {
      if (item.prop === e) {
        item.clearValidate();
      }
    });
  },

  // 去除数据空值和后面的逗号
  jsonArray: function (arr, e) {
    arr += "," + e;
    arr = arr.split(",");
    let r = arr.filter(s => {
      return s && s.trim();
    });
    return r.toString();
  },

  // 删除图片
  deleteArray: function (arr, e) {
    arr = arr.split(",");
    arr.forEach((item, index) => {
      if (parseInt(item) === e) {
        arr.splice(index, 1);
      }
    });
    return arr.toString();
  }

}
